package com.example.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
public class DemoController {

    @GetMapping("/greeting")
    public String greeting(
            @RequestParam(name="name",required = false,defaultValue = "World")String name,
            Model model){
        model.addAttribute("name",name);
        return "greeting";
    }
    @RequestMapping("/experience")
    @ResponseBody
    public Map<String,Object> experience(){
        Map<String,Object> map = new HashMap<>(2);
        map.put("name","songjun");
        map.put("experience",15);
        return map;
    }
}
<<<<<<< HEAD

=======
<<<<<<< HEAD
//suyuqiu
=======
//luyasi
>>>>>>> 536005dee221b7fed79077dd267015ea7800183c
>>>>>>> 830b377f751958ab329ec96a5d106a75069f35ab
